package com.fa4j.product.category.model;

import com.fa4j.common.base.model.CommonState;
import com.fa4j.common.base.model.ModifyCmd;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;

import java.util.List;

@Data
@Schema(description = "商品分类编辑参数")
public class CategoryModifyCmd extends ModifyCmd<Integer> {

    @NotBlank
    @Size(max = 32)
    @Schema(description = "分类名称")
    private String name;

    @NotNull
    @Schema(description = "分类图片ID")
    private Long imgId;

    @NotNull
    @Schema(description = "状态")
    private CommonState state;

    @NotNull
    @Schema(description = "优先级")
    private Integer priority;

    @Schema(description = "商品分类属性列表")
    private List<@Valid Attribute> attrList;

    @Schema(description = "商品分类属性参数")
    public record Attribute(
            @NotBlank
            @Size(max = 32)
            @Schema(description = "商品分类属性名称")
            String name,

            @Schema(description = "是否必填")
            Boolean required,

            @Schema(description = "是否多选")
            Boolean multi
    ) {
    }

}
